home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1995 October
/
EnigmA AMIGA RUN 01 (1995)(G.R. Edizioni)(IT)[!][issue 1995-10][Aminet 7].iso
/
Aminet
/
dev
/
gcc
/
ixemul_src.lha
/
ixemul-41.0
/
man
/
cat2
/
chmod.0
< prev
next >
Wrap
Text File
|
1992-08-10
|
5KB
|
133 lines
CHMOD(2) UNIX Programmer's Manual CHMOD(2)
NNAAMMEE
cchhmmoodd, ffcchhmmoodd - change mode of file
SSYYNNOOPPSSIISS
##iinncclluuddee <<ssyyss//ssttaatt..hh>>
_i_n_t
cchhmmoodd(_c_o_n_s_t _c_h_a_r _*_p_a_t_h, _m_o_d_e___t _m_o_d_e)
_i_n_t
ffcchhmmoodd(_i_n_t _f_d, _m_o_d_e___t _m_o_d_e)
DDEESSCCRRIIPPTTIIOONN
The function cchhmmoodd() sets the file permission bits of the file specified
by the pathname _p_a_t_h to _m_o_d_e. FFcchhmmoodd() sets the permission bits of the
specified file descriptor _f_d. CChhmmoodd() verifies that the process owner
(user) either owns the file specified by _p_a_t_h (or _f_d), or is the super
user. A mode is created from _o_r'd permission bit masks defined in
<_s_y_s_/_s_t_a_t_._h>:
#define S_IRWXU 0000700 /* RWX mask for owner */
#define S_IRUSR 0000400 /* R for owner */
#define S_IWUSR 0000200 /* W for owner */
#define S_IXUSR 0000100 /* X for owner */
#define S_IRWXG 0000070 /* RWX mask for group */
#define S_IRGRP 0000040 /* R for group */
#define S_IWGRP 0000020 /* W for group */
#define S_IXGRP 0000010 /* X for group */
#define S_IRWXO 0000007 /* RWX mask for other */
#define S_IROTH 0000004 /* R for other */
#define S_IWOTH 0000002 /* W for other */
#define S_IXOTH 0000001 /* X for other */
#define S_ISUID 0004000 /* set user id on execution */
#define S_ISGID 0002000 /* set group id on execution */
#define S_ISVTX 0001000 /* save swapped text even after use */
The ISVTX (the _s_t_i_c_k_y _b_i_t) indicates to the system which executable files
are shareable (the default) and the system maintains the program text of
the files in the swap area. The sticky bit may only be set by the super
user on shareable executable files.
If mode ISVTX (the `sticky bit') is set on a directory, an unprivileged
user may not delete or rename files of other users in that directory. The
sticky bit may be set by any user on a directory which the user owns or
has appropriate permissions. For more details of the properties of the
sticky bit, see sticky(8).
Writing or changing the owner of a file turns off the setuserid and
setgroupid bits unless the user is the superuser. This makes the sys
tem somewhat more secure by protecting setuserid (setgroupid) files
from remaining setuserid (setgroupid) if they are modified, at the
expense of a degree of compatibility.
RREETTUURRNN VVAALLUUEESS
Upon successful completion, a value of 0 is returned. Otherwise, a value
of 1 is returned and _e_r_r_n_o is set to indicate the error.
EERRRROORRSS
CChhmmoodd() will fail and the file mode will be unchanged if:
[ENOTDIR] A component of the path prefix is not a directory.
[EINVAL] The pathname contains a character with the highorder bit
set.
[ENAMETOOLONG]
A component of a pathname exceeded 255 characters, or an
entire path name exceeded 1023 characters.
[ENOENT] The named file does not exist.
[EACCES] Search permission is denied for a component of the path
prefix.
[ELOOP] Too many symbolic links were encountered in translating the
pathname.
[EPERM] The effective user ID does not match the owner of the file
and the effective user ID is not the superuser.
[EROFS] The named file resides on a readonly file system.
[EFAULT] _P_a_t_h points outside the process's allocated address space.
[EIO] An I/O error occurred while reading from or writing to the
file system.
FFcchhmmoodd() will fail if:
[EBADF] The descriptor is not valid.
[EINVAL] _F_d refers to a socket, not to a file.
[EROFS] The file resides on a readonly file system.
[EIO] An I/O error occurred while reading from or writing to the
file system.
SSEEEE AALLSSOO
chmod(1), open(2), chown(2), stat(2), sticky(8)
SSTTAANNDDAARRDDSS
CChhmmoodd() is expected to conform to IEEE Std 1003.11988 (``POSIX'').
HHIISSTTOORRYY
The ffcchhmmoodd() function call appeared in 4.2BSD.
4th Berkeley Distribution March 10, 1991 2